<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #mask{
      position: fixed;
      left: 0;
      right: 0;
      top:0;
      bottom: 0;
      background-color: rgba(0,0,0,.7);
      z-index: 10000;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    #content{
      width: 50%;
      height:50%;
      background-color: #fff;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="showModal">显示弹窗</button>
     <div id="mask" @click.self="hideModal" v-show="isShow">
       <div id="content">
         <p>内容1</p>
         <button>按钮</button>
         <div>内容</div>
       </div>
     </div>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp({
      data(){
        return {
          isShow: false
        }
      },
      methods: {
        showModal(){
          this.isShow = true;
        },
        hideModal(){
          this.isShow = false;
        }
      }
    })
    // 实例渲染
    app.mount('#app');
  </script>
</body>
</html>